#!/bin/bash

# 创建存储目录
mkdir -p /nfs_share/k8s/harbor/database/pv{1..3}

# 设置权限
# 为什么使用 999:999？因为 Harbor-database 的容器通常以 UID 999 运行。
chown -R 999:999 /nfs_share/k8s/harbor/database/pv{1..3}

# 添加共享目录信息
echo "/nfs_share/k8s/harbor *(rw,sync,no_subtree_check,no_root_squash)" >> /etc/exports
echo "/nfs_share/k8s/harbor/database/pv1 *(rw,sync,no_subtree_check,no_root_squash)" >> /etc/exports
echo "/nfs_share/k8s/harbor/database/pv2 *(rw,sync,no_subtree_check,no_root_squash)" >> /etc/exports
echo "/nfs_share/k8s/harbor/database/pv3 *(rw,sync,no_subtree_check,no_root_squash)" >> /etc/exports


# 解析/etc/exports文件
exportfs -r

# 查看共享目录信息
exportfs -v | grep /nfs_share/k8s/harbor
